home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_RenderCircle.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  1KB  |  68 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. #ifdef DO_TAPEDECK_KIND
  10. VOID __regargs
  11. LTP_RenderCircle(struct RastPort *RPort,LONG Left,LONG Top,LONG Radius,LONG AspectX,LONG AspectY)
  12. {
  13.     LONG x = 0,y = Radius,Delta = 2 * (1 - Radius),delta,Limit = 0,Length;
  14.  
  15.     while(y >= Limit)
  16.     {
  17.         if(Delta < 0)
  18.         {
  19.             delta = 2 * Delta + 2 * y - 1;
  20.  
  21.             if(delta > 0)
  22.             {
  23.                 x = x + 1;
  24.                 y = y - 1;
  25.                 Delta = Delta + 2 * x - 2 * y + 2;
  26.             }
  27.             else
  28.             {
  29.                 x = x + 1;
  30.                 Delta = Delta + 2 * x + 1;
  31.             }
  32.         }
  33.         else
  34.         {
  35.             if(Delta > 0)
  36.             {
  37.                 delta = 2 * Delta - 2 * x - 1;
  38.  
  39.                 if(delta > 0)
  40.                 {
  41.                     y = y - 1;
  42.                     Delta = Delta - 2 * y + 1;
  43.                 }
  44.                 else
  45.                 {
  46.                     x = x + 1;
  47.                     y = y - 1;
  48.                     Delta = Delta + 2 * x - 2 * y + 2;
  49.                 }
  50.             }
  51.             else
  52.             {
  53.                 x = x + 1;
  54.                 y = y - 1;
  55.                 Delta = Delta + 2 * x - 2 * y + 2;
  56.             }
  57.         }
  58.  
  59.         Length = (x * AspectY) / AspectX;
  60.  
  61.         Move(RPort,Left - Length,Top + y - 1);
  62.         Draw(RPort,Left + Length - 1,Top + y - 1);
  63.         Move(RPort,Left - Length,Top - y);
  64.         Draw(RPort,Left + Length - 1,Top - y);
  65.     }
  66. }
  67. #endif    /* DO_TAPEDECK_KIND */
  68.